package spring.cloud.tasks.executor.name_space.executor.task.task_listener.task_configuration;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import spring.cloud.tasks.common.node.TaskNodePath;


@Slf4j
@Setter
@Getter
public final class TaskConfigurationNode {

    public static final String root_node = "task_configuration";

    public static final String task_class = root_node + "/id";//任务和beanId的关联id

    public static final String task_item_total_count = root_node + "/task_item_total_count";


    public static final String prefer_list = root_node + "/prefer_list";

    public static final String cron_expression_update_id = root_node + "/cron_expression_update_id";
    public static final String cron = root_node + "/cron";
    public static final String pause_date_period = root_node + "/pause_date_period";

    public static final String pause_time_period = root_node + "/pause_time_period";

    public static final String task_item_parameters = root_node + "/task_item_parameters";

    public static final String task_parameter = root_node + "/task_parameter";


    public static final String show_normal_log = root_node + "/show_normal_log";

    public static final String description = root_node + "/description";

    public static final String timeout_seconds = root_node + "/timeout_seconds";

    public static final String load_Level = root_node + "/load_Level";

    public static final String enabled = root_node + "/enabled";


    public static final String to_delete = root_node + "/to_delete";


    public static final String use_dis_prefer_list = root_node + "/use_dis_prefer_list";

    /**
     * 任务类型: 动态写入
     */
    public static final String task_type = root_node + "/task_type";

    /**
     * 自定义上下文
     */
    public static final String custom_context = root_node + "/custom_context";


    /**
     * 判断是否为任务调度配置路径.
     *
     * @param path 节点路径
     * @return 是否为任务调度配置路径
     */
    public static boolean isCronPath(final String taskId, final String path) {
        return TaskNodePath.getTaskNodePath(taskId, cron).equals(path);
    }

    public static boolean isEnabledPath(final String taskId, final String path) {
        return TaskNodePath.getTaskNodePath(taskId, enabled).equals(path);
    }

    public static boolean isToDeletePath(final String taskId, final String path) {
        return TaskNodePath.getTaskNodePath(taskId, to_delete).equals(path);
    }


}
